import '@/utils/request.js'
import {$get} from "@/utils/api/getApi";
// https://zuche.mylocation.cn/prod-api/wxuser/appconfig/list?type=获取小程序密钥id

// 手机号一键登录
export const openIdLoginfoin = (data) => {
    //return uni.$post('wxuser/wechatuser/login', data)
    return uni.$get(`/wechat/customer/openIdLoginClient/${uni.getAccountInfoSync().miniProgram.appId}/${data}`)
}

// export const openIdLoginfoin = (data) => {
//     //return uni.$post('wxuser/wechatuser/login', data)
//     return uni.$get(`/wechat/customer/openIdLogin/${data}` )
// }

// 手机号一键登录
// export const loginfoin = (data) => {
//     //return uni.$post('wxuser/wechatuser/login', data)
//     return uni.$post('/wechat/customer/login', data)
// }

export const loginfoin = (data) => {
    //return uni.$post('wxuser/wechatuser/login', data)
    return uni.$post(`/wechat/customer/login/${uni.getAccountInfoSync().miniProgram.appId}`, data)
}
// 短信验证发送接口: 
export const logwechatusersendMsg = (data) => {
    return uni.$get('/wxuser/wechatuser/sendMsg?phone=' + data)
}
// 车辆列表
export const getlistrec = (data) => {
    return uni.$get('/vehicle/goods/list?cartype=' + data.cartype + '&status=1&sid=' + data.sid + '&structure=' +
        data.structure + '&grarbox=' + data.grarbox + '&orderby=' + data.orderBy + '&pageNum=' + data.pageNum + '&pageSize=' + data.pageSize + '&seviceType=' + data.seviceType)
}
// 筛选车辆型号类型
export const getvehicle_grarbox_vehicle_structure = (datatype) => {
    return uni.$get('/system/dict/data/list?dictType=' + datatype)
}

// 车辆详情
export const getvehiclegoods = (data) => {
    return uni.$get('/wechat/goods/' + data)
}
// 车辆编辑接口 ：  https://zuche.mylocation.cn/prod-api/vehicle/goods    put方式
export const putvehiclegoods = (data) => {
    return uni.$put('/vehicle/goods', data)
}
// 车辆类型
export const getdictTypelist = (data) => {
    return uni.$get('/system/dict/data/list?dictType=vehicle_type')
}
// 门店列表
export const getbranchlist = (data) => {
    return uni.$get('/shop/branch/list?isCoordinate=true&userLng=' + data.userLng + '&userLat=' + data.userLat + '&name=' + data.name +
        '&uniacid=' + data.uniacid + '&pageNum=' + data.pageNum + '&pageSize=' + data.pageSize)
}
// 门店详情
export const getshopbranch = (data) => {
    return uni.$get('/shop/branch/' + data)
}
// 添加订单
export const postordervehorderadd = (data) => {
    return uni.$post('/order/vehorder', data)
}
// 订单列表
export const getordervehorderlist = (data) => {
    return $get('/wechat/vehorder/list', data)
}
// 订单详情
export const getordervehorder = (data) => {
    return uni.$get('/wechat/vehorder/' + data)
}
// 修改订单状态
export const putordervehorder = (data) => {
    return uni.$put('/wechat/vehorder', data)
}

// 订单支付
export const postordervehorder = (data) => {
    return uni.$post('/order/vehorder/unifiedOrder', data)
}

// 驾驶员列表查询接口：
export const getwxuserdriverlist = (id) => {
    return uni.$get('/wechat/driver/list?uid=' + id)
}
// 驾驶员新增接口：
export const getwxuserdriver = (data) => {
    return uni.$post('/wechat/driver', data)
}
// 驾驶员编辑接口：
export const putwxuserdriver = (data) => {
    return uni.$put('/wechat/driver', data)
}
// 驾驶员删除接口：
export const deletewxuserdriver = (data) => {
    return uni.$delete('/wechat/driver/' + data)
}

// 上传人脸识别头像的接口：
// export const getcommonupload = (data) => {
// 	return uni.$post('/common/upload',data)
// } 页面直接用了 没有在这使用了
// 查询微信用户对象的接口：
export const getwechatuserlist = (data) => {
    return uni.$get('/wechat/customer/list?openid=' + data)
}
// 更新微信用户信息的接口：
export const putwxuserwechatuser = (data) => {
    return uni.$put('/wxuser/wechatuser', data)
}

//商家登录 https://zuche.mylocation.cn/prod-api/system/user/merchantLogin?username=昌顺租车&password=123456
export const postsystemusermerchantLogin = (data) => {
    return uni.$get('/system/user/merchantLogin?username=' + data.username + '&password=' + data.password)
}
// 是否开启语音提醒https://zuche.mylocation.cn/prod-api/order/vehorder/getAudioSwitch
export const getvehordergetAudioSwitch = (data) => {
    return uni.$get('/order/vehorder/getAudioSwitch')
}
// // 订单身份证，驾驶证上传接口 ： https://zuche.mylocation.cn/prod-api/order/vehorder/upload/files  
// export const ordervehorderuploadfiles = (data) => {
// 	return uni.$get('/order/vehorder/upload/files')
// }
// 支付完之后 发送短信的接口：   https://zuche.mylocation.cn/prod-api/order/vehorder/sendMsg    传递参数：订单对象
export const postordervehordersendMsg = (data) => {
    return uni.$post('/order/vehorder/sendMsg', data)
}


// 查用户所关注的门店接口 ：  https://zuche.mylocation.cn/prod-api/shop/follow/list

export const getshopfollowlist = (data) => {
    return uni.$get('/shop/follow/list?userId=' + data)
}
//关注，取关门店接口 ： https://zuche.mylocation.cn/prod-api/shop/follow      传递参数 ImsBranchFollow对象       post方式  
export const postshopfollow = (data) => {
    return uni.$post('/shop/follow', data)
}

//通过用户id获取客户识别码
export const getUserCode = () => {
    return uni.$get('/wechat/vehorder/getRandomCode')
}
